import axios from "@/utils/common/axios";
import type { ResponseData } from "@/utils/common/axios";

export default {
	/**
	 * 获取城市列表
	 */
	getCityList(): Promise<ResponseData> {
		return axios.request({
			url: '/system/tenant_city/list',
			method: 'GET'
		})
	},
	/**
	 * 根据城市id获取区域列表
	 * @param cityId
	 */
	getAreaListByCityId(cityId?: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/region/list_area_by_city_id/${cityId}`,
			method: 'GET'
		})
	},
	/**
	 * 根据区域id获取街道/乡镇列表
	 * @param areaId
	 */
	getTownListByAreaId(areaId?: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/region/list_town_by_area_id/${areaId}`,
			method: 'GET'
		})
	},
	/**
	 * 新增字典
	 * @param data
	 */
	insertDic(data: any): Promise<ResponseData> {
		return axios.request({
			url: '/system/dictionary/insert',
			method: 'POST',
			data
		})
	},
	/**
	 * 更新字典
	 * @param data
	 */
	updateDic(data: any): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/update/${data.id}`,
			method: 'POST',
			data
		})
	},
	/**
	 * 获取字典
	 * @param id
	 */
	getDicById(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/get/${id}`,
			method: 'GET'
		})
	},
	/**
	 * 根据label获取字典列表
	 * @param label
	 * 使用中
	 */
	getDicListByLabel(label: string, params: any = {isUse: 1}): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/list_dict/${label}`,
			method: 'GET',
			params
		})
	},
	/**
	 * 根据label获取字典列表
	 * @param label
	 */
	getDicListByLabelAll(label: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/list_dict/${label}`,
			method: 'GET'
		})
	},
	/**
	 * 根据pid获取字典列表
	 * @param pid
	 * // 82308字典修改
	 */

	getDicListByPid(pid: string, isUse = 1): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/list_enable_dict/${pid}/${isUse}`,
			method: 'GET'
		})
	},
	/*
	 * 根据pid获取字典列表查询全部
	 * @param pid
	 * // 82308字典修改
	 */
	getDicListByPidAll(pid: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/list_enable_dict/${pid}`,
			method: 'GET'
		})
	},
	/**
	 * 获取部门树列表
	 * @param data
	 */
	getDeptTreeList(): Promise<ResponseData> {
		return axios.request({
			url: '/saas-rental-uaa/uaa/department/forTree',
			method: 'GET'
		})
	},
	/**
	 * 获取部门列表
	 * @param data
	 */
	getDeptSimpleList(): Promise<ResponseData> {
		return axios.request({
			url: '/system/department/list_simple_dept',
			method: 'GET'
		})
	},
	/**
	 * 获取部门门店列表
	 * @param data
	 */
	getDeptStoreList(): Promise<ResponseData> {
		return axios.request({
			url: '/system/department/list_store',
			method: 'GET'
		})
	},
	/**
	 *
	 * 根据部门ID获取员工列表
	 * @param deptId 部门编号
	 */
	getEmpListByDeptId(deptId: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/employee_info/list_dept_emp/${deptId}`,
			method: 'GET'
		})
	},
	/**
	 *
	 * 根据部门编号获取员工列表(包含子部门员工)
	 * @param deptNo 部门编号
	 */
	getSimpleEmpListByDeptNo(deptNo: string): Promise<ResponseData> {
		return axios.request({
			url: `/system/employee_info/list_simple_emp_by_dept_no/${deptNo}`,
			method: 'GET'
		})
	},
	/**
	 *
	 * 获取当前租户下的所有员工列表
	 */
	getAllEmpList(data = {}): Promise<ResponseData> {
		return axios.request({
			url: '/system/employee_info/list_emp_name_dept_info_by_tenant',
			method: 'POST',
			data
		})
	},
	/**
	 * 获取决策表信息列表
	 * @param data
	 * @returns
	 */
	getDecisionList(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/system/decision/list',
			data,
			method: 'POST'
		})
	},
	getHouseCommunityList(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/house/house/list_community',
			method: 'POST'
		})
	},
	// 获取总账单列表
	getGeneralLedger(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/basesearch/finance_bill/contract/total_bill',
			method: 'POST'
		})
	},
	// 合同总账单导出
	exportGeneralLedger(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/basesearch/finance_bill/contract/total_bill/export',
			method: 'POST',
			responseType: 'blob'
		})
	},
	// 获取账单明细列表
	getAllBillDetails(data: object): Promise<ResponseData> {
		return axios.request({
			data,
			url: '/basesearch/finance_bill_detail/list_by_bill',
			method: 'POST'
		})
	},
	// 获取当前房间是否配置
	getConfigurationData(id: string): Promise<ResponseData> {
		return axios.request({
			url: `/house/house_room_detail/get_house_room_detail/${id}`,
			method: 'GET'
		})
	},
	// 编辑租客信息
	updateTenant(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/contract/renter_info/update',
			data,
			method: 'POST'
		})
	},
	//修改租客合同
	updateContract(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/contract/renter_contract/append',
			data,
			method: 'POST'
		})
	},
	//修改企业合同
	updateEnterpriseContract(data: object): Promise<ResponseData> {
		return axios.request({
			url: '/contract/enter_contract/modify',
			data,
			method: 'POST'
		})
	},
	/* 获取人才类型字典 */
	getDictionary(pid: string, isUse = 1): Promise<ResponseData> {
		return axios.request({
			url: `/system/dictionary/list_enable_dict/${pid}/${isUse}`,
			method: 'GET'
		})
	},

	/* 获取人才类型字典 */
	decryptionMobile(mobileCode): Promise<ResponseData> {
		return axios.request({
			url: `/saas-rental-uaa/uaa/shop/admin/decryptionMobile`,
			params:{mobileCode},
			method: 'POST'
		})
	}
}
